package pe.com.bn.sach.dao.impl;

import java.util.List;
import com.ibatis.sqlmap.client.SqlMapClient;
import pe.com.bn.sach.dao.GiroDAO;
import pe.com.bn.sach.domain.Bnchf27GiroActividad;

public class GiroImpl implements GiroDAO {

	
	protected SqlMapClient sqlMap = null;
	
	public void setSqlMap(SqlMapClient sqlMap) {
		this.sqlMap = sqlMap;
	}

	public List buscarGiro(Bnchf27GiroActividad bnchf27Giro) throws Exception{
		return sqlMap.queryForList("sqlGiro.buscarGiro",bnchf27Giro);
	}
	
	public void GuardaGiro(Bnchf27GiroActividad bnchf27Giro)throws Exception{
		
		
		try{
			sqlMap.startTransaction();
			sqlMap.insert("sqlGiro.GuardaGiro",bnchf27Giro);
			sqlMap.commitTransaction();
		}catch(Exception e){
			e.printStackTrace();
			throw e;
		}
		finally{
			sqlMap.endTransaction();
		}
	}
	public void guardarGiro(Bnchf27GiroActividad bnchf27Giro)throws Exception{

		try{
			sqlMap.startTransaction();
			sqlMap.insert("sqlGiro.guardarGiro",bnchf27Giro);
			sqlMap.commitTransaction();
		}catch(Exception e){
			e.printStackTrace();
			throw e;
		}
		finally{
			sqlMap.endTransaction();
		}
		}
	public List busquedaGiro(Bnchf27GiroActividad bnchf27Giro)throws Exception{
		return sqlMap.queryForList("sqlGiro.busquedaGiro",bnchf27Giro);
		}
	
	public void actualizarGiro(Bnchf27GiroActividad bnchf27Giro)throws Exception{
		try{
			sqlMap.startTransaction();
			sqlMap.update("sqlGiro.actualizarGiro",bnchf27Giro);
			sqlMap.commitTransaction();
		}catch(Exception e){
			e.printStackTrace();
			throw e;
		}
		finally{
			sqlMap.endTransaction();
		}
		}
	
	public List listarGiro(Bnchf27GiroActividad bnchf27Giro)throws Exception{
		return sqlMap.queryForList("sqlGiro.listarGiro",bnchf27Giro);
		}
	
}
